package com.tzy.spi.aop;

import java.lang.annotation.Annotation;

public class JoinPoint {

    private  String mName;
    private AopInvoker.InvokerChain chain;

    private Object[] args;

    private int i=0;

    int checkIndex(){
        return i++;
    }

    public JoinPoint(AopInvoker.InvokerChain chain, Object[] args,String mName) {
        this.chain = chain;
        this.args = args;
        this.mName=mName;
    }


    public String methodName(){
        return mName;
    }

    public Object[] getArgs() {
        return args;
    }

    public Object invoke() throws Throwable {
        return chain.next(this);
    }

    public Annotation annotation()  {
        return chain.getAnnotation();
    }

}
